using FrameWorkSong;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DemoCommandBufferLine : MonoBehaviour
{
  public  List<GameObject> games;
    CommandBufferLineCreate commandBufferLineCreate;
    public Camera Camera;
    public Material Material;
    // Start is called before the first frame update
    void Start()
    {
        commandBufferLineCreate = new CommandBufferLineCreate(Camera,Material);
    }

    // Update is called once per frame
    void Update()
    {
        commandBufferLineCreate.Claer();
        DrawLine();
        if (Input.GetKeyDown(KeyCode.C))
        {
            DrawLine();
        }
        if (Input.GetKeyDown(KeyCode.A))
        {
            commandBufferLineCreate.Claer();
        }
    }
 
    void DrawLine()
    {
        List<Vector3> vectors = new List<Vector3>();
        for (int i = 0; i < games.Count; i++)
        {
            vectors.Add(games[i].transform.position);
        }
   
        commandBufferLineCreate.AddData(vectors);
        commandBufferLineCreate.DrawLine();
      
    }
}
